# _*_ coding: UTF-8 _*_
# @Time     : 2021/11/4 11:30
# @Author   : yangshuaishuai
# @Site     : http://www.hzdledu.cn/
# @File     : main_简历跟踪.py
# @Software : PyCharm

from selenium import webdriver
import time
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.common.by import By


class Main_Jlgz():
    def __init__(self, driver):
        self.zpgl_locator = (By.XPATH, '//*[@id="root"]/section/aside/div/ul/li[1]/div')
        self.zpgz_locator = (By.XPATH, '//*[@id="sale$Menu"]/li[1]/div/span')
        self.ctjl_locator = (By.XPATH, '//*[@id="saleRecruitManage$Menu"]/li[1]/a')
        self.ggjl_locator = (By.XPATH, '//*[@id="saleRecruitManage$Menu"]/li[2]/a')

        self.driver = driver
        self.wait = WebDriverWait(self.driver, 30)
    def click_zpgl(self):
        try:
            self.wait.until(expected_conditions.presence_of_element_located(self.zpgl_locator))
            self.driver.find_element(*self.zpgl_locator).click()
        except Exception as e:
            self.driver.get_screenshot_as_file('./log/点击招聘管理错误.png')
            raise e
        time.sleep(2)
    def click_zpgz(self):
        try:
            self.wait.until(expected_conditions.presence_of_element_located(self.zpgz_locator))
            self.driver.find_element(*self.zpgz_locator).click()
        except Exception as e:
            self.driver.get_screenshot_as_file('./log/点击招聘跟踪错误.png')
            raise e
        time.sleep(2)
    def click_ctjl(self):
        try:
            self.wait.until(expected_conditions.presence_of_element_located(self.ctjl_locator))
            self.driver.find_element(*self.ctjl_locator).click()
        except Exception as e:
            self.driver.get_screenshot_as_file('./log/点击传统简历错误.png')
            raise e
        time.sleep(2)
    def click_ggjl(self):
        try:
            self.wait.until(expected_conditions.presence_of_element_located(self.ggjl_locator))
            self.driver.find_element(*self.ggjl_locator).click()
        except Exception as e:
            self.driver.get_screenshot_as_file('./log/点击广告简历错误.png')
            raise e
        time.sleep(2)
